//
//  StoryAPI.swift
//  XNetwork_Example
//
//  Created by x on 2024/8/11.
//  Copyright © 2024 CocoaPods. All rights reserved.
//

import Moya
import XNetwork

enum StoryAPI {
    case latest
}

extension StoryAPI: TargetType, Cacheable {
    
    var baseURL: URL {
        return URL(string: "https://news-at.zhihu.com/api")!
    }
    
    var path: String {
        switch self {
        case .latest:
            return "4/news/latest"
        }
    }
    
    var method: Moya.Method {
        return .get
    }
    
    var sampleData: Data {
        return "".data(using: .utf8)!
    }
    
    var task: Task {
        switch self {
        case .latest:
            return .requestPlain
        }
    }
    
    var headers: [String : String]? {
        return nil
    }
}
